package com.czy.owner.api;

import com.czy.owner.db.UserHelper;
import com.czy.owner.global.Constants;
import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by asus on 2017/6/5.
 */

public class ParityListApi extends BaseApi {
    private String session;
    private String categoryId;
    private String goodsName;
    private String storeId;
    private String goodsActivityId;
    private String page;
    private String size;

    public ParityListApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener, rxAppCompatActivity);

        setShowProgress(false);
        setCache(true);
        setMothed(UserHelper.getInstance().getUserAccount() + Constants.SHOP_MALLRATIOGOODS);//相当于缓存保存的Key
        setCookieNetWorkTime(0);//有网缓存0s,在0s内点击无效
        setCookieNoNetWorkTime(0);//无网缓存7天
    }

    public String getSession() {
        return session;
    }

    public void setSession(String session) {
        this.session = session;
    }

    public String getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getStoreId() {
        return storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public String getGoodsActivityId() {
        return goodsActivityId;
    }

    public void setGoodsActivityId(String goodsActivityId) {
        this.goodsActivityId = goodsActivityId;
    }

    public String getPage() {
        return page;
    }

    public void setPage(String page) {
        this.page = page;
    }

    public String getSize() {
        return size;
    }

    public void setSize(String size) {
        this.size = size;
    }

    /*
    *  * @Field("session") String session,
     * @Field("categoryId") String categoryId,
     * @Field("goodsName") String goodsName,
     * @Field("storeId") String storeId
    , @Field("goodsActivityId") String goodsActivityId,
     @Field("page") String page,
     @Field("size") String size);
    * */
    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        return service.mallRatioGoods(session, getCategoryId(), getGoodsName(), getStoreId(), getGoodsActivityId(), getPage(), getSize());
    }
}
